package tk.djcrazy.instantmessage.action;

import java.util.Map;

import org.apache.struts2.interceptor.SessionAware;

import tk.djcrazy.instantmessage.domain.UserEntity;
import tk.djcrazy.instantmessage.service.IUserService;

import com.opensymphony.xwork2.ActionSupport;

public class GetFriendListAction extends ActionSupport implements SessionAware {
	private static final long serialVersionUID = 3852398417813319408L;
	private Map<String, Object> session;
	private IUserService userService;
	private UserEntity entity;

	public String execute() {
		try {
			int uid = (Integer) session.get("uid");
			entity = userService.findById(uid);
			return SUCCESS;
		} catch (Exception e) {
			e.printStackTrace();
			return ERROR;
		}
	}

	public Map<String, Object> getSession() {
		return session;
	}

	public void setSession(Map<String, Object> session) {
		this.session = session;
	}

	public IUserService getUserService() {
		return userService;
	}

	public void setUserService(IUserService userService) {
		this.userService = userService;
	}

	public UserEntity getEntity() {
		return entity;
	}

	public void setEntity(UserEntity entity) {
		this.entity = entity;
	}

}
